package com.sky.seekbar;

import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import java.util.Random;

public class MainActivity extends AppCompatActivity
{

    private CustormSeekBar custormSeekBar;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initListener();
    }

    /**
     * 初始化view
     */
    public void initView()
    {
        custormSeekBar = (CustormSeekBar) findViewById(R.id.custormSeekBar);
        refreshView();
    }

    public void viewOnClick(View view)
    {
        refreshView();
    }

    public void refreshView()
    {
        Random random=new Random();
        CustormSeekBar.SeekBarData leftSeekBarData = new CustormSeekBar.SeekBarData();
        CustormSeekBar.SeekBarData rightSeekBarData = new CustormSeekBar.SeekBarData();
        leftSeekBarData.setDataValue(random.nextInt(123456));
        leftSeekBarData.setDataValueColor(Color.WHITE);
        leftSeekBarData.setLabelColor(Color.CYAN);
        leftSeekBarData.setLabelValue("10月");

        rightSeekBarData.setDataValue(random.nextInt(123456));
        rightSeekBarData.setDataValueColor(Color.WHITE);
        rightSeekBarData.setLabelColor(Color.CYAN);
        rightSeekBarData.setLabelValue("11月");
        custormSeekBar.setLeftSeekBarColor(Color.BLUE);
        custormSeekBar.setRightSeekBarColor(getResources().getColor(R.color.blue_color));
        custormSeekBar.setSeekBarBgColor(getResources().getColor(R.color.cambridge_blue_color));
        custormSeekBar.setLeftSeekBarData(leftSeekBarData);
        custormSeekBar.setRightSeekBarData(rightSeekBarData);
        custormSeekBar.refreshView();
    }

    /**
     * 初始化组件点击事件
     */
    public void initListener()
    {

    }
}
